package site.icesky.springboot.log.controller;

import brave.Tracer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import site.icesky.springboot.log.service.LogService;

/**
 * @ClassName: SpringRedisController <br>
 * @Description: 测试jedis <br>
 * @Package: site.icesky.springredis.controller <br>
 * @author: suitianmou <br>
 * @Date: 2020/5/19-23:54 <br>
 * @version: 1.0 <br>
 * @see <br>
 * @since (从产品的哪一个版本此类被添加进来 ( 可选))<br>
 * 修改历史: <br>
 * 修改时间             修改人           版本变更           修改说明<br>
 * -----------------------------------------------------<br>
 * <br>
 */
@RestController
public class LogController {

    private static final Logger logger = LoggerFactory.getLogger(LogController.class);

    @Autowired
    LogService logService;

    @Autowired
    private Tracer tracer;

    @RequestMapping(path="/log")
    @ResponseBody
    public String loglog(){

//        Span currentSpan = tracer.currentSpan();
//        currentSpan.tag("tag-key", "tag-value");
//        Span newSpan = tracer.nextSpan();

        logger.info("tracer:" + tracer.toString());
        logger.info("MDC的值" + MDC.get("X-B3-SpanId"));

        return logService.logTest();
    }

}
